buy tb500

Archive for the ‘Kubernetes’ Category

Create a pod called httpd using the image httpd:alpine in the default namespace. Next, create a service of type ClusterIP by the same name (httpd). The target port for the service should be 80.

Saturday, October 15th, 2022

$kubectl run httpd –image=httpd:alpine –port=80 –expose

Create a new pod called custom-nginx using the nginx image and expose it on container port 8080.

Saturday, October 15th, 2022

$kubectl run custom-nginx –image=nginx –port=8080

Create a service redis-service to expose the redis application within the cluster on port 6379.

Saturday, October 15th, 2022

$kubectl expose pod redis –port=6379 –name redis-service

Deploy a redis pod using the redis:alpine image with the labels set to tier=db

Saturday, October 15th, 2022

Run the command to generate the definition file:

$kubectl run redis --image=redis:alpine --dry-run=client -oyaml > redis-pod.yaml

apiVersion: v1
kind: Pod
    tier: db
  name: redis
  - image: redis:alpine
    name: redis
  dnsPolicy: ClusterFirst
  restartPolicy: Always

Then run the command: kubectl create -f redis-pod.yaml to create the pod from the definition file.

OR Use the imperative command: –

$kubectl run redis -l tier=db --image=redis:alpine

Kubernetes imperative commands

Saturday, October 15th, 2022

note: there is no space between – – in the below commands

$kubectl run – -image=nginx nginx

$kubectl create deployment – -image=nginx nginx

$kubectl expose deployment nginx – -port 80

$kubectl edit deployment nginx

$kubectl scale deployment nginx – -replicas=5

$kubectl set image deployment nginx nginx =nginx:1.18

Check the latest stable version available for upgrade? Kubernetes

Tuesday, June 28th, 2022

kubeadm upgrade plan

get pod yaml file

Monday, June 27th, 2022

kubectl get pod orange -o yaml > /root/orange.yaml

Create namespace in kubernetes

Tuesday, May 3rd, 2022
kubectl create namespace default-mem-example

Get deployment to a yaml format

Tuesday, May 3rd, 2022

kubectl get deployments.apps blue -o yaml > blue.yaml

Which nodes pods places on

Tuesday, May 3rd, 2022

kubectl get pods -o wide