Skip to content

Instantly share code, notes, and snippets.

# AWS CLI install
curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-environment-variables
namespace: kube-system
data:
HTTPS_PROXY: http://customer.proxy.host:proxy_port
HTTP_PROXY: http://customer.proxy.host:proxy_port
NO_PROXY: <k8s_CIDR in the form x.x.x.x/x>,localhost,127.0.0.1,<VPC_CIDR in the form x.x.x.x/x>,169.254.169.254,.internal,<VPC_Endpoints_Optional>
@leandrosiow
leandrosiow / kubectl_cmd_get_clusterIP.sh
Last active January 31, 2020 16:59
You can use this command to get the clusterIP. #eks #kubectl
kubectl get service kubernetes -o jsonpath='{.spec.clusterIP}'; echo
@leandrosiow
leandrosiow / cfn_eks_linux_proxy.yaml
Last active February 2, 2020 06:16
This is a CloudFormation template to setup a Linux proxy
AWSTemplateFormatVersion: 2010-09-09
Description: Amazon EKS - Node Group
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: EKS Cluster
Parameters:
- ClusterName
- ClusterControlPlaneSecurityGroup
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: <ARN of instance role (not instance profile)>
username: system:node:{{EC2PrivateDNSName}}
groups:
# This script sets up the VPC Webhook for an EKS Cluster.
#
# Download the webhook-create-signed-cert.sh and webhook-patch-ca-bundle.sh files
curl -o webhook-create-signed-cert.sh https://amazon-eks.s3-us-west-2.amazonaws.com/manifests/us-west-2/vpc-admission-webhook/latest/webhook-create-signed-cert.sh
curl -o webhook-patch-ca-bundle.sh https://amazon-eks.s3-us-west-2.amazonaws.com/manifests/us-west-2/vpc-admission-webhook/latest/webhook-patch-ca-bundle.sh
# Download the Deployment YAML file
curl -o vpc-admission-webhook-deployment.yaml https://amazon-eks.s3-us-west-2.amazonaws.com/manifests/us-west-2/vpc-admission-webhook/latest/vpc-admission-webhook-deployment.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Amazon EKS - Windows Node Group.
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: EKS Cluster
Parameters:
@leandrosiow
leandrosiow / kubelet-config-all-options.json
Last active November 8, 2023 05:03
These are examples of kubelet-config.json files
{
"kind": "KubeletConfiguration",
"apiVersion": "kubelet.config.k8s.io/v1beta1",
"syncFrequency": "1m0s",
"fileCheckFrequency": "20s",
"httpCheckFrequency": "20s",
"address": "0.0.0.0",
"port": 10250,
"tlsCertFile": "/root/cdk/server.crt",
"tlsPrivateKeyFile": "/root/cdk/server.key",
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=/sbin/iptables -P FORWARD ACCEPT
ExecStart=/usr/bin/kubelet --cloud-provider aws \
--config /etc/kubernetes/kubelet/kubelet-config.json \
@leandrosiow
leandrosiow / kubelet.service
Last active February 9, 2020 22:07
Here is an example of the kubelet service file created by eksctl
file that has been created by eksctl
```
# /etc/systemd/system/kubelet.service
# eksctl-specific systemd drop-in unit for kubelet, for Amazon Linux 2 (AL2)
[Service]
# Local metadata parameters: REGION, AWS_DEFAULT_REGION
EnvironmentFile=/etc/eksctl/metadata.env
# Global and static parameters: CLUSTER_DNS, NODE_LABELS, NODE_TAINTS
EnvironmentFile=/etc/eksctl/kubelet.env