Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloud-computing-msc-ai-examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Rieger
cloud-computing-msc-ai-examples
Commits
3a1c789f
Commit
3a1c789f
authored
4 years ago
by
Timo Geier
Browse files
Options
Downloads
Patches
Plain Diff
Improved Kubernetes cluster documentation
parent
350d47b1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
kubernetes-example/kubectl-intro.md
+56
-3
56 additions, 3 deletions
kubernetes-example/kubectl-intro.md
kubernetes-example/nginx.yml
+20
-0
20 additions, 0 deletions
kubernetes-example/nginx.yml
kubernetes-example/service.yml
+16
-0
16 additions, 0 deletions
kubernetes-example/service.yml
with
92 additions
and
3 deletions
kubernetes-example/kubectl-intro.md
+
56
−
3
View file @
3a1c789f
# Introduction to kubectl
# Introduction to kubectl
## Prerequisites
For using this you must install the following tools:
-
Python
-
Pip
-
Kubectl
-
Openstack-Client
### Python
Install python and pip for your OS, if it is not installed. This is already done at the NetLab PCs.
### Installing kubectl and arkade
Run this in a
**bash**
terminal to download arkade and install kubectl:
For windows you can use e.g. the
**Git Bash**
terminal.
```
bash
curl
-sLS
https://dl.get-arkade.dev | sh
arkade get kubectl
# To load the path to the binary
export
PATH
=
$PATH
:
$HOME
/.arkade/bin/
```
With arkade you can also install other tools:
```arkade get```
to see all possibilities.
### Openstack Client
To install the Openstack client and the magnum package:
If you are using Windows, you must start the bash terminal with
**Administrator**
privileges!
```
bash
pip3
install
openstackclient python-magnumclient
# Download the Openstack RC File from your Openstack account
# Load the file
source
{
USERNAME
}
-openrc
.sh
```
### Download the kubeconfig
Download the kubeconfig file for your cluster from OpenStack.
```
bash
# Before using this, check if Openstack RC File is loaded!
openstack coe cluster config
{
CLUSTER_NAME
}
# Then run the given command in terminal
export
...
# Now you are able to run kubectl commands at your Kubernetes cluster
```
## Deployment of the needed description in kubernetes
## Deployment of the needed description in kubernetes
These are two approaches to create the description in Kuber
e
ntes:
These are two approaches to create the description in Kubern
e
tes:
```
bash
```
bash
# create a namespace
# create a namespace
...
@@ -41,10 +94,10 @@ kubectl logs -n web-test deployment/nginx-deployment
...
@@ -41,10 +94,10 @@ kubectl logs -n web-test deployment/nginx-deployment
```
bash
```
bash
# scale up instances to 5
# scale up instances to 5
kubectl scale deployment/nginx-deployment
--replicas
=
5
kubectl scale
-n
web-test
deployment/nginx-deployment
--replicas
=
5
# scale down instances again to 3
# scale down instances again to 3
kubectl scale deployment/nginx-deployment
--replicas
=
3
kubectl scale
-n
web-test
deployment/nginx-deployment
--replicas
=
3
```
```
...
...
This diff is collapsed.
Click to expand it.
kubernetes-example/nginx.yml
0 → 100644
+
20
−
0
View file @
3a1c789f
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
nginx-deployment
namespace
:
web-test
spec
:
selector
:
matchLabels
:
app
:
nginx-deployment
replicas
:
3
# tells deployment to run 3 pods matching the template
template
:
metadata
:
labels
:
app
:
nginx-deployment
spec
:
containers
:
-
name
:
nginx
image
:
nginx:latest
ports
:
-
containerPort
:
80
\ No newline at end of file
This diff is collapsed.
Click to expand it.
kubernetes-example/service.yml
0 → 100644
+
16
−
0
View file @
3a1c789f
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
nginx-service
namespace
:
web-test
spec
:
type
:
NodePort
selector
:
app
:
nginx-deployment
ports
:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
-
port
:
80
targetPort
:
80
# Optional field
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
nodePort
:
30007
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment