Skip to content

Instantly share code, notes, and snippets.

# run nginx pods via deployment
$ kubectl run nginx-is-dumb --image=nginx --replicas=2 --port=80
deployment "nginx-is-dumb" created
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-is-dumb-2691305027-lmmnb 1/1 Running 0 20m
nginx-is-dumb-2691305027-r0n7c 1/1 Running 0 20m
# back them by a service
https://github.com/kelseyhightower/kubernetes-the-hard-way/tree/master/docs
systemd: https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal
https://www.linuxtrainingacademy.com/systemd-cheat-sheet/
kubectl: https://kubernetes.io/docs/user-guide/kubectl-cheatsheet/
worker nodes:
- kube proxy: $ ps ax | grep kubeproxy
- kubelet: systemctl list-units grep hyperkube | kubelet.service
- kubelet: sudo systemctl status kubelet
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
int main() {
int ret;
struct addrinfo hints;
struct addrinfo *res;
apiVersion: v1
kind: Pod
metadata:
name: log-app
labels:
app: log-app
spec:
containers:
- name: log-app
image: quay.io/leahnp/leah_log_app:latest
@leahnp
leahnp / Instrumentation 12-08-16
Created December 8, 2016 18:41
Kubernetes SIG Instrumentation meeting notes | 12-8-2016
12-8-2016 | K8s SIG Instrumentation meeting
Piotr: Kubelet cli create new logging #33111 issue, what are some solutions?
Patrick: wants to discuss LogDir proposal - status?
Piotr: problem with LogDir, there is no description/plan for finishing task
Patrick: has questions and wants details about solution for LogDir task, wants to avoid re-hashing issues that have already been discussed. Storage SIG doesn’t want to deal with logging details. Can we find someone to flesh this out and implement?
LogDir: field added to volume spec to indicate it's a logging volume and policy ( log rotation, location on disc) Kubelet could expose to host and let aggregator pull logs from connection.
Mik: files for volumes that we want to mount somehow, that would be responsibility of the Kubelet
Piotr: two proposals that are similar - which problem do we want to address. Basically we want to support more logging sources than just STDERR/STDOUT. SOLUTION: add sidecar to pick up logs,
@leahnp
leahnp / calc1.rb
Created February 21, 2016 22:48
Calculator Homework
# Leah Petersen
# HW 2-21-16 Calculator
# Baseline and primary requirments, first three optional enhancements
# Calc performs one operation on two numbers only
puts "Hi, welcome to THE CALCULATOR. You can add/+, subtract/-, multiply/*, divide//, exponent/**, modulo/% two numbers.\n\n"
# get first number
puts "What is the first number in your equation?"
num1 = gets.chomp.strip
# if value is decimal, string to float if whole, string to integer
@leahnp
leahnp / account_generator4.rb
Created February 21, 2016 22:26
Jumpstart Account Generator
# Leah Petersen
# HW 2-19-16 "Account Generator"
### This program takes in file of names, creates an id and email, inserts name,
# id, email as hash into student data array, prints student roster.
### This program does not account for multiple last names or hypenated names,
# it justs takes the very last name and uses it as the last name for the email
# prompts user for file name
puts "What file do you want to open?"
file = gets.chomp
@leahnp
leahnp / random_menu.rb
Created February 19, 2016 00:22
HW 2-17 "Menu Generator"
#Leah Petersen
#Random menu generator 2-17-16
# arrays with food, adjectives and style
# food = ["Rockfish", "Poached Eggs", "Rack of Lamb", "Taco", "Pizza", "Sandwich", "Fried Chicken", "Antelope", "Jellyfish", "Ice Cream"]
# food_adjectives = ["Seared", "Al Dente", "Braised", "Hot", "Spicey and Sweet", "Excellent", "Cold", "Runny", "Med-Rare", "Popular"]
# food_style = ["Eco-inspired", "Local", "Slow Food", "Southern", "Latin", "Handmade", "Organic", "Natural", "GMO Free", "Gluten-Free"]
# empty arrays for user input
food = []
@leahnp
leahnp / hours_in_year.rb
Created February 18, 2016 06:42
HW 2-16 "Hours in a year"
#leah petersen
#homework 2-16-16 "hours-in-a-year"
#format number strings with US-style commas
def separate_comma(number)
whole, decimal = number.to_s.split(".")
whole_with_commas = whole.chars.to_a.reverse.each_slice(3).map(&:join).join(",").reverse
[whole_with_commas, decimal].compact.join(".")
end