From Beocat
Jump to: navigation, search
No edit summary
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Nautilus ==
To access the Nautilus namespace, first make an account at https://portal.nrp-nautilus.io/ . Once you have done so, email beocat@cs.ksu.edu and request to be added to the Beocat Nautilus namespace (ksu-nrp-cluster). Once you have received notification that you have been added to the namespace, you can continue with the following steps to get set up to use the cluster resources.  
To access the Nautilus namespace, first make an account at https://portal.nrp-nautilus.io/ . Once you have done so, email beocat@cs.ksu.edu and request to be added to the Beocat Nautilus namespace (ksu-nrp-cluster). Once you have received notification that you have been added to the namespace, you can continue with the following steps to get set up to use the cluster resources.  
<ol>
<ol>
<li>SSH into headnode.beocat.ksu.edu
<li>SSH into headnode.beocat.ksu.edu</li>
2. SSH into fiona (fiona hosts the kubectl tool we will use for this assignment)
<li>SSH into fiona (fiona hosts the kubectl tool we will use for this)</li>
3. Once on fiona, use the command ‘cd ~’ to ensure you are in your home directory. If you
<li>Once on fiona, use the command ‘cd ~’ to ensure you are in your home directory. If you
are not, this will return you to the top level of your home directory.
are not, this will return you to the top level of your home directory.<li>
4. From there you will need to create a .kube directory inside of your home directory. Use
<li>From there you will need to create a .kube directory inside of your home directory. Use
the command ‘mkdir ~/.kube’
the command ‘mkdir ~/.kube’</li>
5. Login to https://portal.nrp-nautilus.io/ using the same login previously used to create your
<li>Login to https://portal.nrp-nautilus.io/ using the same login previously used to create your
account (this will be your K-State EID login)
account (this will be your K-State EID login)</li>
6. From here it is MANDATORY to read the cluster policy documentation provided by the
<li>From here it is MANDATORY to read the cluster policy documentation provided by the
National Research Platform for the Nautilus program. You can find this here.
National Research Platform for the Nautilus program. You can find this here.
https://docs.nationalresearchplatform.org/userdocs/start/policies/
https://docs.nationalresearchplatform.org/userdocs/start/policies/ </li>
&nbsp a. This is to ensure we do not break any of the rules put in place by the NRP.
a. This is to ensure we do not break any of the rules put in place by the NRP.
7. Next, return to the website specified in step 5, in the top right corner of the page press
<li>Next, return to the website specified in step 5, in the top right corner of the page press
the “Get Config” option.
the “Get Config” option. </li>
a. This will download a file called ‘config’
a. This will download a file called ‘config’
8. You will need to move the file to your ~/.kube directory created in step 4.
<li>You will need to move the file to your ~/.kube directory created in step 4.</li>
a. To do this you can copy and paste the contents through the command line
a. To do this you can copy and paste the contents through the command line
b. You can also utilize the OpenOnDemand tool to upload the file through the web
<br>b. You can also utilize the OpenOnDemand tool to upload the file through the web
interface. Information for this tool can be found here:
interface. Information for this tool can be found here:
https://support.beocat.ksu.edu/Docs/OpenOnDemand
https://support.beocat.ksu.edu/Docs/OpenOnDemand
c. You can also use other means of moving the contents to the Beocat
<br>c. You can also use other means of moving the contents to the Beocat
headnodes/your home directory, but these are just a few examples.
headnodes/your home directory, but these are just a few examples.
d. NOTE: Because we added a period before the filename it is now a hidden file,
<br>d. NOTE: Because we added a period before the directory name it is now a hidden directory,
and the file will not appear when running a normal ‘ls’, to see the file you will
and the directory will not appear when running a normal ‘ls’, to see the directory you will
need to run “ls -a” or “ls -la”.
need to run “ls -a” or “ls -la”.
9. Once you have read the required documentation, created the .kube directory in your
<li>Once you have read the required documentation, created the .kube directory in your
home directory, and placed the config file in this folder, you are now ready to continue!
home directory, and placed the config file in the '~/.kube' directory, you are now ready to continue!</li>
10. Download the supplied pod1.yaml file. Next edit the file and change the “name:” field
<li>Below is an example pod that can be used. It does not request much in the way of resources so you will likely need to change some things. Be sure to change the “name:” field
underneath “metadata:”. Change the text “test-pod” to “{eid}-pod” where ‘{eid}’ is your
underneath “metadata:”. Change the text “test-pod” to “{eid}-pod” where ‘{eid}’ is your
K-State ID. It will look something like this “dan-pod”.
K-State ID. It will look something like this “dan-pod”.</li>
11. Place this file in the same directory created earlier (~/.kube).
 
12. If you are not already in the .kube directory enter the command “cd ~/.kube” to change
<syntaxhighlight lang=yaml>
your current directory.
apiVersion: v1
13. Now we are going to create our ‘pod’. This will request a ubuntu pc using the
kind: Pod
specifications we specified earlier in pod1.yaml.
metadata:
  name: test-pod
spec:
  containers:
  - name: mypod
    image: ubuntu
    resources:
      limits:
        memory: 400Mi
        cpu: 100m
      requests:
        memory: 100Mi
        cpu: 100m
    command: ["sh", "-c", "echo 'Im a new pod' && sleep infinity"]
</syntaxhighlight>
<li>Place your .yaml file in the same directory created earlier (~/.kube).</li>
<li>If you are not already in the .kube directory enter the command “cd ~/.kube” to change
your current directory.</li>
<li>Now we are going to create our ‘pod’. This will request a ubuntu pc using the
specifications from above.</li>
a. To do this enter the command “kubectl create -f pod1.yaml” NOTE: You must be
a. To do this enter the command “kubectl create -f pod1.yaml” NOTE: You must be
in the same directory that you placed the pod1.yaml file in.
in the same directory that you placed the pod1.yaml file in (in this situation, the above pod config was put into a file named pod1.yaml).
b. If the command is successful you will see an output of “pod/{eid}-pod created”.
<br>b. If the command is successful you will see an output of “pod/{eid}-pod created”.
14. You will need to wait until the container for the pod is finished creating. You can check
<li>You will need to wait until the container for the pod is finished creating. You can check
this by running “kubectl get pods”
this by running “kubectl get pods”</li>
a. Once you run this command, it will output all the pods currently running or being
a. Once you run this command, it will output all the pods currently running or being
created in the namespace. Look for yours among the list of pods, the name will
created in the namespace. Look for yours among the list of pods, the name will
be the same name specified in step 10.
be the same name specified in step 10.
b. Once you locate your pod, check its STATUS. If the pod says Running, then you
<br>b. Once you locate your pod, check its STATUS. If the pod says Running, then you
are good to proceed. If it says ContainerCreating, then you will need to wait just a
are good to proceed. If it says Container Creating, then you will need to wait just a
bit. It should not take long.
bit. It should not take long.
15. You can now execute and enter the pod by running “kubectl exec -it {eid}-pod --
<li>You can now execute and enter the pod by running “kubectl exec -it {eid}-pod --
/bin/bash”. Where ‘{eid}-pod’ is the pod created in step 13/the name specified in step 10.
/bin/bash”. Where ‘{eid}-pod’ is the pod created in step 13/the name specified in step 10.</li>
a. Executing this command will open the pod you created and run a bash console
a. Executing this command will open the pod you created and run a bash console
on the pod.
on the pod.
b. From here you will be able to do most things you would normally do in a ubuntu
<br>b. NOTE: If you have trouble logging into the pod, and are met with a “You must be
pc.
c. NOTE: If you have trouble logging into the pod, and are met with a “You must be
logged in to the server, you can run “kubectl proxy”, and after a moment, you can
logged in to the server, you can run “kubectl proxy”, and after a moment, you can
cancel the command with a “crtl+c”. This should remedy the error.
cancel the command with a “crtl+c”. This should remedy the error.
16. Now for the actual assignment to get results that we will use to test against Beocat.
17. From here we need to run a few commands that will set up the pod so that we can
compile and run C programs inside of it, as the pod is a barebones ubuntu pc with not
many packages installed.
a. Follow this list of commands:
i. $apt-get update
ii. $apt-get install build-essentials (accept the certificate request if prompted,
as well as the space utilization request)
iii. To check and make sure the GCC compiler is installed we can use $gcc
--version
iv. $apt install net-tools
v. Install your favorite text editor (vim or nano typically)
1. $apt install vim
a. Or
2. $apt install nano
18. Now with the prerequisites out of the way, create a program in C that will measure the
time it takes to gather the hostname of the computer. Accomplish this by gathering the
time at the start of your program and then gathering it again at the end of the program.
You will then need to print out both the Hostname and the time taken to gather the
Hostname using print statements.
a. With GCC you can compile it by entering the command “gcc -o SomeName
SomeOtherName.c” where SomeName is the file you want to create for
execution and SomeOtherName.c is the file you wish to input to the compiler.
19. Once you are done with the pod and you exit out, make sure you delete it. To do this, on
fiona, run the command “kubectl delete pod {eid}-pod” where the “{eid}-pod” is the pod
name specified in step 10.
20. Using the same C script you wrote in step 18, get the same measurements through the
slurm job manager (sbatch) on one of the headnodes of Beocat. As well, add a
constraint to only use the moles.
21. Compare these two outputs and write an analysis of the time difference. Include
observations such as “Why would it be beneficial to use pod based computing”, feel free
to include other observations. Turn in this analysis as well as a screenshot of both of the
time taken measurements and the hostnames as well as the C files used for computation
to canvas in a zip file.
</ol>
</ol>
Additional documentation for Kubernetes can be found on the Kubernetes website https://kubernetes.io/docs/home

Latest revision as of 17:40, 1 October 2024

Nautilus

To access the Nautilus namespace, first make an account at https://portal.nrp-nautilus.io/ . Once you have done so, email beocat@cs.ksu.edu and request to be added to the Beocat Nautilus namespace (ksu-nrp-cluster). Once you have received notification that you have been added to the namespace, you can continue with the following steps to get set up to use the cluster resources.

  1. SSH into headnode.beocat.ksu.edu
  2. SSH into fiona (fiona hosts the kubectl tool we will use for this)
  3. Once on fiona, use the command ‘cd ~’ to ensure you are in your home directory. If you are not, this will return you to the top level of your home directory.
  4. From there you will need to create a .kube directory inside of your home directory. Use the command ‘mkdir ~/.kube’
  5. Login to https://portal.nrp-nautilus.io/ using the same login previously used to create your account (this will be your K-State EID login)
  6. From here it is MANDATORY to read the cluster policy documentation provided by the National Research Platform for the Nautilus program. You can find this here. https://docs.nationalresearchplatform.org/userdocs/start/policies/
  7. a. This is to ensure we do not break any of the rules put in place by the NRP.
  8. Next, return to the website specified in step 5, in the top right corner of the page press the “Get Config” option.
  9. a. This will download a file called ‘config’
  10. You will need to move the file to your ~/.kube directory created in step 4.
  11. a. To do this you can copy and paste the contents through the command line
    b. You can also utilize the OpenOnDemand tool to upload the file through the web interface. Information for this tool can be found here: https://support.beocat.ksu.edu/Docs/OpenOnDemand
    c. You can also use other means of moving the contents to the Beocat headnodes/your home directory, but these are just a few examples.
    d. NOTE: Because we added a period before the directory name it is now a hidden directory, and the directory will not appear when running a normal ‘ls’, to see the directory you will need to run “ls -a” or “ls -la”.
  12. Once you have read the required documentation, created the .kube directory in your home directory, and placed the config file in the '~/.kube' directory, you are now ready to continue!
  13. Below is an example pod that can be used. It does not request much in the way of resources so you will likely need to change some things. Be sure to change the “name:” field underneath “metadata:”. Change the text “test-pod” to “{eid}-pod” where ‘{eid}’ is your K-State ID. It will look something like this “dan-pod”.
  14. apiVersion: v1
    kind: Pod
    metadata:
      name: test-pod
    spec:
      containers:
      - name: mypod
        image: ubuntu
        resources:
          limits:
            memory: 400Mi
            cpu: 100m
          requests:
            memory: 100Mi
            cpu: 100m
        command: ["sh", "-c", "echo 'Im a new pod' && sleep infinity"]
    
  15. Place your .yaml file in the same directory created earlier (~/.kube).
  16. If you are not already in the .kube directory enter the command “cd ~/.kube” to change your current directory.
  17. Now we are going to create our ‘pod’. This will request a ubuntu pc using the specifications from above.
  18. a. To do this enter the command “kubectl create -f pod1.yaml” NOTE: You must be in the same directory that you placed the pod1.yaml file in (in this situation, the above pod config was put into a file named pod1.yaml).
    b. If the command is successful you will see an output of “pod/{eid}-pod created”.
  19. You will need to wait until the container for the pod is finished creating. You can check this by running “kubectl get pods”
  20. a. Once you run this command, it will output all the pods currently running or being created in the namespace. Look for yours among the list of pods, the name will be the same name specified in step 10.
    b. Once you locate your pod, check its STATUS. If the pod says Running, then you are good to proceed. If it says Container Creating, then you will need to wait just a bit. It should not take long.
  21. You can now execute and enter the pod by running “kubectl exec -it {eid}-pod -- /bin/bash”. Where ‘{eid}-pod’ is the pod created in step 13/the name specified in step 10.
  22. a. Executing this command will open the pod you created and run a bash console on the pod.
    b. NOTE: If you have trouble logging into the pod, and are met with a “You must be logged in to the server, you can run “kubectl proxy”, and after a moment, you can cancel the command with a “crtl+c”. This should remedy the error.

Additional documentation for Kubernetes can be found on the Kubernetes website https://kubernetes.io/docs/home