Introduction
this is part 42 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.
And I will cover lot of tools as we move on.
Lab
if you already have the DevOps folder just pull it and you will get the new files.
if not go and clone the repo
first let's explain our configuration file.
apiVersion: v1
kind: Service
metadata:
name: my-nginx
labels:
run: my-nginx
spec:
ports:
- port: 80
protocol: TCP
selector:
run: my-nginx
here we are going to create an simple service that we can access from other pod (I was preparing a bigger example but my country have problems with internet so I change the lab idea to smaller one , but will reach same thing that I need to explain in this part) .
kubectl apply -f nginx-svc.yaml
apply will behave same as create but apply will record the change so technically it's better to use.
kubectl get svc my-nginx
svc is the shortcut of services...
we can see the ip is 10.99.76.0 keep it in mind
kubectl run curl --image=radial/busyboxplus:curl -i --tty
this will create a pod for us in imperative way , for busybox image and will run the shell for us.
nslookup my-nginx
nslookup is a network administration command-line tool available in many computer operating systems for querying the Domain Name System to obtain domain name or IP address mapping, or other DNS records. The name "nslookup" means "name server lookup".Wikipedia
my-nginx is the name we specify in the yml file "name: my-nginx" we can see that we are able to access the nginx service also we can see the ip which is the same 10.99.76.0
Top comments (0)