Commit 47e37839 authored by Larkin Heintzman's avatar Larkin Heintzman

clean up

parent 8ceeb352
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
......@@ -91,3 +91,20 @@ nodeSelector:
check which pods are running on which nodes:
kubectl get pods --all-namespaces -o wide
get join command from host computer:
kubeadm token create --print-join-command
sucessful ARM image build:
docker buildx build --platform linux/arm64 -o type=oci,dest=droneARM.img -t llh/dronearm:v0 .
-----------------------------------------------------------
handy troubleshooting links:
crashloop backoff evaluation steps: https://managedkube.com/kubernetes/pod/failure/crashloopbackoff/k8sbot/troubleshooting/2019/02/12/pod-failure-crashloopbackoff.html
docker buildx, building for multiple architectures: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/
buildx platform error thingy: https://github.com/docker/buildx/issues/464
This diff is collapsed.
# syntax=docker/dockerfile:1
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
retries = 5
while True:
try:
return cache.incr('hits')
except redis.exceptions.ConnectionError as exc:
if retries == 0:
raise exc
retries -= 1
time.sleep(0.5)
@app.route('/')
def hello():
count = get_hit_count()
return 'Hello World! I have been seen {} times.\n'.format(count)
version: "3.3"
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
To test a quick docker web app, with steps/code taken from https://docs.docker.com/compose/gettingstarted/
- from project directory, start up docker daemon (not sure why this isn't a service):
sudo dockerd
- bring up container (again from project dir, separate terminal):
sudo docker-compose up
- check http://localhost:5000/ to see if page loads, refresh to see counter incrementing
if dockerd comes back with an error the following command might be needed:
ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh
FROM busybox
CMD echo $((40 + 2))
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","echo $((40 + 2))"],"Image":"sha256:42b97d3c2ae95232263a04324aaf656dc80e7792dee6629a9eff276cdfb806c0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"7844ba4fcb3e2573beee308f75094be8428cf1a99076340d971f9f0b2b61b9cc","container_config":{"Hostname":"7844ba4fcb3e","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/bin/sh\" \"-c\" \"echo $((40 + 2))\"]"],"Image":"sha256:42b97d3c2ae95232263a04324aaf656dc80e7792dee6629a9eff276cdfb806c0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2021-09-13T17:33:29.768365573Z","docker_version":"20.10.8","history":[{"created":"2021-08-20T21:20:01.375838656Z","created_by":"/bin/sh -c #(nop) ADD file:89552401a4d4fc6b2e7e019e9dff35d16de40ad30973d5ccdd78d3de33790155 in / "},{"created":"2021-08-20T21:20:01.541762445Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]","empty_layer":true},{"created":"2021-09-13T17:33:29.768365573Z","created_by":"/bin/sh -c #(nop) CMD [\"/bin/sh\" \"-c\" \"echo $((40 + 2))\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:0fd05bf2930d72edc1aa0b9fa7e442295c2384512a32c0b1502392f5384acd81"]}}
\ No newline at end of file
{"id":"e93c093b65bb10672e77027c11ee804f192a401d94cf1b8f53fcc84d6335f6d3","created":"2021-09-13T17:33:29.768365573Z","container":"7844ba4fcb3e2573beee308f75094be8428cf1a99076340d971f9f0b2b61b9cc","container_config":{"Hostname":"7844ba4fcb3e","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/bin/sh\" \"-c\" \"echo $((40 + 2))\"]"],"Image":"sha256:42b97d3c2ae95232263a04324aaf656dc80e7792dee6629a9eff276cdfb806c0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"docker_version":"20.10.8","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","echo $((40 + 2))"],"Image":"sha256:42b97d3c2ae95232263a04324aaf656dc80e7792dee6629a9eff276cdfb806c0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"architecture":"amd64","os":"linux"}
\ No newline at end of file
[{"Config":"42ca20c5edcca8f3790773dd6111e6eb360f56a7a2fabcd4feba72a940b1eccb.json","RepoTags":["calc:latest"],"Layers":["e93c093b65bb10672e77027c11ee804f192a401d94cf1b8f53fcc84d6335f6d3/layer.tar"]}]
{"calc":{"latest":"e93c093b65bb10672e77027c11ee804f192a401d94cf1b8f53fcc84d6335f6d3"}}
......@@ -21,9 +21,17 @@ spec:
spec:
containers:
- name: drone
image: llh/drone:v0
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev/ttyACM0
name: ttyacm
- mountPath: /dev/dji_usb
name: ttydji
image: llh/dronearm:v0
command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 plathReady std_msgs/String 'ready'"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 armReady std_msgs/String 'ready'"]
# args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh"]
ports:
- containerPort: 11311
name: droneport
......@@ -34,6 +42,13 @@ spec:
value: service-drone
nodeSelector:
name: plath
volumes:
- name: ttyacm
hostPath:
path: /dev/ttyACM0
- name: ttydji
hostPath:
path: /dev/dji_usb
---
......
......@@ -46,7 +46,7 @@ spec:
- name: ROS_HOSTNAME
value: service-talker
nodeSelector:
name: neruda
name: plath
# When the roscore container stops or fails, all the node
# containers need to be restarted because the ros network
# configuration is lost.
......
apiVersion: v1
kind: Pod
metadata:
name: listener
labels:
name: listener
spec:
containers:
- name: listener
image: ros:indigo-ros-core
env:
- name: ROS_HOSTNAME
value: listener
- name: ROS_MASTER_URI
value: http://master:11311
args:
- rostopic
- echo
- my_topic
apiVersion: v1
kind: Service
metadata:
name: listener
spec:
clusterIP: None
ports:
- port: 11311
protocol: TCP
selector:
name: listener
type: ClusterIP
apiVersion: v1
kind: Pod
metadata:
name: master
labels:
name: master
spec:
containers:
- name: master
image: roscluster/master:v0
ports:
- containerPort: 11311
name: master
# args:
# - roscore
apiVersion: v1
kind: Service
metadata:
name: master
spec:
clusterIP: None
ports:
- port: 11311
protocol: TCP
selector:
name: master
type: ClusterIP
apiVersion: v1
kind: Pod
metadata:
name: talker
labels:
name: talker
spec:
containers:
- name: talker
image: ros:indigo-ros-core
env:
- name: ROS_HOSTNAME
value: talker
- name: ROS_MASTER_URI
value: http://master:11311
args:
- rostopic
- pub
- "-r"
- "1"
- my_topic
- std_msgs/String
- "SPLab+ICClab"
apiVersion: v1
kind: Service
metadata:
name: talker
spec:
clusterIP: None
ports:
- port: 11311
protocol: TCP
selector:
name: talker
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: hello-python-service
spec:
selector:
app: hello-python
ports:
- protocol: "TCP"
port: 6000
targetPort: 5000
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-python
spec:
selector:
matchLabels:
app: hello-python
replicas: 4
template:
metadata:
labels:
app: hello-python
spec:
containers:
- name: hello-python
image: hello-python:latest
imagePullPolicy: Never
ports:
- containerPort: 5000
ros-kubernetes-ex @ 316101e9
Subproject commit 316101e906c06ce40993a4398a90ea2ba46b8000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment