Archive for October, 2022
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, 2022Run the command to generate the definition file:
$kubectl run redis --image=redis:alpine --dry-run=client -oyaml > redis-pod.yaml --- apiVersion: v1 kind: Pod metadata: labels: tier: db name: redis spec: containers: - 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, 2022note: 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
prevent any one access wordpress admin
Sunday, October 9th, 2022#AuthName "Admins Only"
# ALLOW USER BY IP
<Limit GET POST>
order deny,allow
deny from all
allow from 1.2.3.4
allow from 5.6.7.8
</Limit>
# PREVENT VIEWING OF .HTACCESS
<Files .htaccess>
order allow,deny
deny from all
</Files>