Kubernetes: Difference between revisions

From Skytech
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
* http://alesnosek.com/blog/2017/02/14/accessing-kubernetes-pods-from-outside-of-the-cluster/
* http://alesnosek.com/blog/2017/02/14/accessing-kubernetes-pods-from-outside-of-the-cluster/


= Disable some RBD features (or k8s will fail to launch pod) =
= Petsets =
* fast-diff
* object-map
* deep-flatten

must all be disabled
<pre>
<pre>
rbd feature disable ssd/elasticsearch-data-01 fast-diff object-map deep-flatten
Skip to content
</pre>
Personal Open source Business Explore

Sign upSign inPricingBlogSupport
= RBD inside kubernetes =
This repository
* https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd
Search

Watch 1,512 Star 18,562 Fork 6,134 kubernetes/kubernetes
Spent some time toying around with it but couldn't get it to work - it is a must to add the secret as described here: https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd#use-ceph-authentication-secret and also add that part to the manifest:
Code Issues 4,613 Pull requests 678 Projects 7 Wiki Pulse Graphs
<pre>
Branch: master Find file Copy pathkubernetes/test/e2e/testing-manifests/petset/redis/petset.yaml
...
f2bab13 4 days ago
user: admin
@janetkuo janetkuo Remove 0 terminationGracePeriodSeconds from statefulset manifests
keyring: /etc/ceph/ceph.client.admin.keyring
2 contributors @janetkuo @bprashanth
secretRef:
RawBlameHistory
name: ceph-secret
98 lines (97 sloc) 2.66 KB
...
apiVersion: apps/v1beta1
</pre>
kind: StatefulSet
Link to example rbd manifest: https://github.com/kubernetes/examples/blob/master/staging/volumes/rbd/rbd.yaml


= Kube-dns - stub local DNS-servers with ip and zones =
<pre>
apiVersion: v1
kind: ConfigMap
metadata:
metadata:
name: rd
name: kube-dns
namespace: kube-system
spec:
data:
serviceName: "redis"
replicas: 3
stubDomains: |
{"hq.skytech.dk": ["192.168.0.24", "10.0.0.24"]}
template:

metadata:
labels:
app: redis
annotations:
pod.alpha.kubernetes.io/initialized: "true"
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "install",
"image": "gcr.io/google_containers/redis-install-3.2.0:e2e",
"imagePullPolicy": "Always",
"args": ["--install-into=/opt", "--work-dir=/work-dir"],
"volumeMounts": [
{
"name": "opt",
"mountPath": "/opt"
},
{
"name": "workdir",
"mountPath": "/work-dir"
}
]
},
{
"name": "bootstrap",
"image": "debian:jessie",
"command": ["/work-dir/peer-finder"],
"args": ["-on-start=\"/work-dir/on-start.sh\"", "-service=redis"],
"env": [
{
"name": "POD_NAMESPACE",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
}
],
"volumeMounts": [
{
"name": "opt",
"mountPath": "/opt"
},
{
"name": "workdir",
"mountPath": "/work-dir"
}
]
}
]'
spec:
containers:
- name: redis
image: debian:jessie
ports:
- containerPort: 6379
name: peer
command:
- /opt/redis/redis-server
args:
- /opt/redis/redis.conf
readinessProbe:
exec:
command:
- sh
- -c
- "/opt/redis/redis-cli -h $(hostname) ping"
initialDelaySeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /data
- name: opt
mountPath: /opt
volumes:
- name: opt
emptyDir: {}
- name: workdir
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: datadir
annotations:
volume.alpha.kubernetes.io/storage-class: anything
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
</pre>
</pre>

Latest revision as of 09:17, 13 August 2019


How to access Pods externally

Disable some RBD features (or k8s will fail to launch pod)

  • fast-diff
  • object-map
  • deep-flatten

must all be disabled

rbd feature disable ssd/elasticsearch-data-01 fast-diff object-map deep-flatten

RBD inside kubernetes

Spent some time toying around with it but couldn't get it to work - it is a must to add the secret as described here: https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd#use-ceph-authentication-secret and also add that part to the manifest:

...
            user: admin
            keyring: /etc/ceph/ceph.client.admin.keyring
            secretRef:
              name: ceph-secret
...

Link to example rbd manifest: https://github.com/kubernetes/examples/blob/master/staging/volumes/rbd/rbd.yaml


Kube-dns - stub local DNS-servers with ip and zones

apiVersion: v1
kind: ConfigMap
metadata:
    name: kube-dns
    namespace: kube-system
data:
    stubDomains: |
        {"hq.skytech.dk": ["192.168.0.24", "10.0.0.24"]}